define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'writergoodszzsh/index' + location.search,
                    // add_url: 'writergoodszzsh/add',
                    edit_url: 'writergoodszzsh/edit',
                    // del_url: 'writergoodszzsh/del',
                    // multi_url: 'writergoodszzsh/multi',
                    // import_url: 'writergoodszzsh/import',
                    // table: 'writer_goods',
                }
            });

            var table = $("#table");
            
            //类型？ 所属行业/推广平台/修改方式/内容方向/应用方向/作品类型/
            //项目经验/文笔类型/修改类型/相应资质/应用类型/文笔风格
         
                $(".status_cl").click(function(){
                    
                    
                  
                    var Industry = "所属行业"
                    var experience = "项目经验"
                    
                    
                    var s = $(this).children().attr("data-value");
              
                    switch (s) {
                        case "0":
                            Industry = "所属行业";
                            experience = "项目经验";
                            // code
                            break;
                         case "1":
                             Industry = "推广平台";
                             experience = "文笔类型";
                                          
                            // code
                            break; 
                          case "2":
                            Industry = "修改方式";
                            experience = "修改类型";
                            // code
                            break;   
                        case "3":
                            Industry = "内容方向";
                            experience = "相应资质";
                            // code
                            break;   
                        case "4":
                            Industry = "应用方向";
                            experience = "应用类型";
                            // code
                            break;   
                        case "5":
                            Industry = "作品类型";
                            experience = "文笔风格";
                            // code
                            break;   
                        case "6":
                            Industry = "修改方式";
                            experience = "文笔风格";
                            // code
                            break;       
                        default:
                            // code
                    }
                        
                      $(".th-inner").eq(4).html(Industry)
                      $(".th-inner").eq(5).html(Industry)
                  
                });
                
    
            

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'weigh',
                fixedColumns: true,
                fixedRightNumber: 1,
                columns: [
                    [
                        {checkbox: true},
                        // {field: 'id', title: __('Id')},
                        {field: 'dream_id', title: __('dream号')},
                        {field: 'type_name', title: __('Type_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,hidden:function(){
                            return true;
                        }},
                        // {field: 'title', title: __('Title'), operate: 'LIKE'},
                        // {field: 'row_type', title: __('Row_type')},
                        // {field: 'price', title: __('Price'), operate:'BETWEEN'},
                        // {field: 'word_count', title: __('Word_count'), operate: 'LIKE'},
                        // {field: 'start_shooting', title: __('Start_shooting'), operate: 'LIKE'},
                        // {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        // {field: 'status', title: __('Status')},
                        // {field: 'sh_time', title: __('Sh_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        // {field: 'refuse_msg', title: __('Refuse_msg'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        // {field: 'buy_num', title: __('Buy_num')},
                        // {field: 'type', title: __('Type')},
                     
                        // {field: 'rank', title: __('Rank')},
                        // {field: 'rank_num', title: __('Rank_num')},
                        // {field: 'look_num', title: __('Look_num')},
                        // {field: 'word_count_label', title: __('Word_count_label'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        // {field: 'weigh', title: __('Weigh'), operate: false},
                        // {field: 'type_class', title: __('Type_class'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        // {field: 'is_w', title: __('Is_w')},
                        // {field: 'tips', title: __('Tips'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                      
                        {field: 'duration', title: __('Duration'), operate: 'LIKE'},
                        
                        
                        {field: 'industry', title: "所属行业", operate: 'LIKE'},
                        {field: 'experience', title: __('项目经验'), operate: 'LIKE'},
                        {field: 'zz_status', title: __('审核状态'), searchList: {"0":__('申请中'),"1":__('审核中'),"2":__('审核通过'),"3":__('审核失败')}, formatter: Table.api.formatter.normal},
                       
                       
                        {field: 'type', title: __('审核状态'), searchList: {"0":__('商用文'),"1":__('宣发文'),"2":__('应用文'),"3":__('写文案'),"4":__('润色修改'),"5":__('定制文'),"6":__('其他')}, formatter: Table.api.formatter.normal},
                       
                       
                        {field: 'create_time', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});
